
#import "UIViewController+LanBLog.h"
#import "LanBSwizzle.h"
#import "LanBLogger.h"

@implementation UIViewController (LanBLog)

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        // viewWillAppear
        {
            SEL originalSelector = @selector(viewWillAppear:);
            SEL swizzledSelector = @selector(lanB_viewWillAppear:);
            lanB_swizzle_instanceMethod(originalSelector, swizzledSelector, self);
        }
        // viewWillDisappear
        {
            SEL originalSelector = @selector(viewWillDisappear:);
            SEL swizzledSelector = @selector(lanB_viewWilldisApper:);
            lanB_swizzle_instanceMethod(originalSelector, swizzledSelector, self);
        }
        // dealloc
        {
            SEL originalSelector = NSSelectorFromString(@"dealloc");
            SEL swizzledSelector = @selector(lanB_dealloc);
            lanB_swizzle_instanceMethod(originalSelector, swizzledSelector, self);
        }
    });
}

- (void)lanB_viewWillAppear:(BOOL)animated {
    [self lanB_viewWillAppear:animated];
}

- (void)lanB_viewWilldisApper:(BOOL)animated {
    [self lanB_viewWilldisApper:animated];
}

- (void)lanB_dealloc {
    NSLog(@"-----*** dealloc -- %@", self);
    [self lanB_dealloc];
}


@end
